{extend name="template/base" /}
{block name="style"}
<!--select2样式 start -->
<link href="__LIB__/select2-4.0.3/dist/css/select2.min.css" rel="stylesheet" />
<!--select2样式 end -->
{/block}
{block name="content"}
<div class="page-container">
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
        <input type="hidden" name="id" value="{$vo.id ?? ''}">
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">司机姓名：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <p>{$vo.realname ?? '未填写'}</p>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">线路名称：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <p>{$vo.title ?? '未填写'}</p>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">酒店名称：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <p>{$vo.hotel_name ?? '未填写'}</p>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">房型：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <p>{$vo.room_name ?? '未填写'}</p>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">合计：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <p>{$vo.total_price ?? '未填写'}</p>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">备注：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <p>{$vo.remark ?? '未填写'}</p>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">申请结算时间：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <p>{:date('Y-m-d H:i:s',$vo.create_time) ?? '未填写'}</p>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">结算方式：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="结算方式" name="settlement_mode" value="{$vo.settlement_mode ?? ''}">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <div id="content"></div>
                <button type="button" class="btn btn-primary radius" onclick="submitSriver()">&nbsp;&nbsp;结算&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="script"}

<!--时间插件-->
<script type="text/javascript" src="__LIB__/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript" src="__LIB__/template/template.js"></script>
<!--select2 js 插件-->
<script type="text/javascript" src="__LIB__/select2-4.0.3/dist/js/select2.min.js"></script>
<script>
    function submitSriver() {
//        console.log('sdfdsf', $('#form').serialize())
        $.ajax({
            type: 'post',
            url: '/admin/driver_hotel_expense/confirm_settlement',
            data: $('#form').serializeArray(),
            success: function (data) {
                console.log('data', data);
                if (data.code == 0) {
                    layer.msg(data.msg, {
                        icon: 1,
                        time: 1500 //2秒关闭（如果不配置，默认是3秒）
                    }, function () {
                        window.parent.location.reload(); //刷新父页面
                        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引\
                        parent.layer.close(index)
                    });
                } else {
                    layer.msg(data.msg, {
                        icon: 1,
                        time: 1500 //2秒关闭（如果不配置，默认是3秒）
                    }, function () {
                        // location.reload();
                    });
                }
            },
            error: function (data) {
                layer.msg(data.msg, {
                    icon: 1,
                    time: 1500 //2秒关闭（如果不配置，默认是3秒）
                }, function () {
                    // location.reload();
                });
                console.log('data', data);
            }
        })
    }
</script>
{/block}
